﻿
namespace CoolpadContactConverter
{
    class Program
    {
        public static IState ReadSourceState { get { return readSourceState; } }
        public static IState SaveToDestnationState { get { return saveToDestnationState; } }
        public static IState SuccessState { get { return successState; } }

        static readonly IState readSourceState = new ReadSourceState();
        static readonly IState saveToDestnationState = new SaveToDestnationState();
        static readonly IState successState = new SuccessState();

        static void Main(string[] args)
        {
            IState current = readSourceState;
            while ((current = current.Do()) != null) ;
        }
    }

    struct Contact
    {
        public string Name { get; private set; }
        public string[] Phones { get; private set; }

        public Contact(string name, string[] phones)
            : this()
        {
            Name = name;
            Phones = phones;
        }

        public override string ToString()
        {
            string s = Name + "： ";

            foreach (string p in Phones)
                if (p.Length > 0)
                    s += p + ", ";
            return s.Substring(0, s.Length - 2);
        }
    }
}
